@extends('admin.base')

@section('content')
    <div class="layui-card">
        <div class="layui-card-header layuiadmin-card-header-auto">
            <div class="layui-btn-group ">
                <button class="layui-btn layui-btn-sm" id="memberSearch">搜索</button>
            </div>
            <div class="layui-form">
                <div class="layui-input-inline">
                    <input type="text" name="phone" id="phone" placeholder="请输会员手机" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-card-body">
            <table id="dataTable" lay-filter="dataTable"></table>

            <script type="text/html" id="avatar">
                <a href="@{{d.avatar}}" target="_blank" title="点击查看"><img src="@{{d.avatar}}" alt="" width="28" height="28"></a>
            </script>
        </div>
    </div>
@endsection

@section('script')
    @can('memberOrder.memberOrder')
        <script>
            layui.use(['layer','table','form'],function () {
                var layer = layui.layer;
                var form = layui.form;
                var table = layui.table;
                //用户表格初始化
                var dataTable = table.render({
                    elem: '#dataTable'
                    ,height: 500
                    ,url: "{{ route('admin.memberOrder.data') }}" //数据接口
                    ,where:{model:"staff"}
                    ,page: true //开启分页
                    ,cols: [[ //表头
                        {checkbox: true,fixed: true}
                        ,{field: 'id', title: 'ID', sort: true,width:80}
                        ,{field: 'order_no', title: '订单号'}
                        ,{field: 'member_phone', title: '会员'}
                        ,{field: 'store_name', title: '店铺'}
                        ,{field: 'discount', title: '折扣'}
                        ,{field: 'discount', title: '支付金额'}
                        ,{field: 'coupon_money', title: '卡券支付金额'}
                        ,{field: 'payment_type', title: '支付方式'}
                        ,{field: 'is_pay', title: '是否支付', templet(data){
                            if (data.is_pay == 1) {
                                return '是'
                            }else {
                                return '否'
                            }
                            }}
                        ,{field: 'pay_time', title: '支付时间'}
                    ]]
                });

                //搜索
                $("#memberSearch").click(function () {
                    var userSign = $("#user_sign").val()
                    var name = $("#name").val();
                    var phone = $("#phone").val();
                    dataTable.reload({
                        where:{user_sign:userSign,name:name,phone:phone},
                        page:{curr:1}
                    })
                })
            })
        </script>
    @endcan
@endsection



